package com.hqyj.dao;

import com.hqyj.pojo.Permission;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.data.repository.query.Param;

import java.util.List;

/**
 * <p>
 * 权限表 Mapper 接口
 * </p>
 *
 * @author rock
 * @since 2021-10-21
 */
public interface PermissionMapper extends BaseMapper<Permission> {

    @Select("SELECT\n" +
            "permission.permission_code\n" +
            "FROM\n" +
            "department_permission\n" +
            "INNER JOIN permission ON department_permission.permission_id = permission.permission_id\n" +
            "INNER JOIN user_department ON user_department.department_id = department_permission.department_id\n" +
            "WHERE sys_id = #{sysId}")
    List<Permission> queryPermissionCode(@Param("sysId") Integer sysId);
}
